home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume5 / xenix-poll < prev    next >
Encoding:
Internet Message Format  |  1989-02-03  |  3.6 KB

  1. Path: xanth!nic.MR.NET!hal!ncoast!allbery
  2. From: rmb384@leah.albany.edu (Robert M. Bownes III)
  3. Newsgroups: comp.sources.misc
  4. Subject: v05i012: Script to poll other uucp sites
  5. Message-ID: <1163@leah.Albany.Edu>
  6. Date: 28 Oct 88 02:41:47 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Reply-To: rmb384@leah.albany.edu (Robert M. Bownes III)
  9. Organization: Mush for Brains
  10. Lines: 121
  11. Approved: allbery@ncoast.UUCP
  12.  
  13. Posting-number: Volume 5, Issue 12
  14. Submitted-by: "Robert M. Bownes III" <rmb384@leah.albany.edu>
  15. Archive-name: xenix-poll
  16.  
  17. [Xenix specific.  Should work on *all* Xenixes except 2.x, though.  ++bsa]
  18. [dumb comment:  the "enable" bug is actually a v7 init "bug", caused by
  19. signal handling limitations.  It doesn't exist on Xenixes with System V
  20. init (/etc/inittab with run levels).  ++bsa]
  21.  
  22.     Here's a shell script for polling other uucp sites on an 
  23. otherwise dialin line. It uses nothing other than enable/disable.
  24. No special getty or login required. It's currently in use on 
  25. a Tandy Sys III Xenix system. Best of luck, and send any bug fixes/reports
  26. to me please.
  27.  
  28. Bob
  29.  
  30.  
  31. #! /bin/sh
  32. # This is a shell archive.  Remove anything before this line, then unpack
  33. # it by saving it into a file and typing "sh file".  To overwrite existing
  34. # files, type "sh file -c".  You can also feed this as standard input via
  35. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  36. # will see the following message at the end:
  37. #        "End of shell archive."
  38. # Contents:  poll
  39. # Wrapped by rmb384@leah.Albany.EDU on Tue Oct 25 15:42:09 1988
  40. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  41. if test -f poll -a "${1}" != "-c" ; then 
  42.   echo shar: Will not over-write existing file \"poll\"
  43. else
  44. echo shar: Extracting \"poll\" \(1414 characters\)
  45. sed "s/^X//" >poll <<'END_OF_poll'
  46. X#!/bin/csh
  47. X#
  48. X#    useage:    poll sys [sys ...]
  49. X#
  50. X#        Poll systems given on the command line.
  51. X#                
  52. X#    History:    10/18/1988    Resurected off of a backup
  53. X#                     and hacked to life.    
  54. X#                    - R.M. Bownes III
  55. X#
  56. X
  57. Xecho $argv
  58. X
  59. X# Check for the presence of a LCK..poll file
  60. X
  61. Xif (-e /usr/spool/uucp/LCK..poll) then
  62. X
  63. X# Look for a currently executing poll.
  64. X
  65. X    if (`ps -elf | grep  -c poll` > 0 ) then
  66. X        echo "Already a poll in progress"
  67. X        exit 
  68. X    endif
  69. X
  70. X# Look for a currently running uucp.
  71. X
  72. X    if (`ps -elf | grep  -c uucico` > 0 ) then
  73. X        echo "Already a uucp in progress"
  74. X        sleep 300
  75. X        exec /usr/lib/uucp/poll
  76. X    endif
  77. X
  78. X# Guess it didnt exist, LCK..poll must be from before the crash...
  79. X
  80. X    rm /usr/spool/uucp/LCK..poll
  81. X    rm /usr/spool/uucp/STST*
  82. Xendif
  83. X
  84. X# Look for a user logged in.
  85. X
  86. Xif (`who | grep  -c tty01` > 0 ) then
  87. X    echo `who | grep tty01 | awk -e '{print $1}'` is on tty01
  88. X    sleep 300
  89. X    exec /usr/lib/uucp/poll
  90. Xendif
  91. X
  92. X# Look for some other uucico going on.
  93. X
  94. X#if (`ps -elf | grep -c uucico` > 0 ) then
  95. X#    echo `ps -elf | grep uucico ` is currently in progress.
  96. X#    sleep 300
  97. X#    exec /usr/lib/uucp/poll
  98. X#endif
  99. X
  100. X# Get ready to dial out.
  101. X
  102. Xtouch /usr/spool/uucp/LCK..poll
  103. Xdisable /dev/tty01
  104. X
  105. X# Do the actual uucp
  106. X
  107. Xwhile ($1 != "") 
  108. X    echo Polling $1
  109. X    /usr/lib/uucp/uucico -r1 -s$1
  110. X    shift
  111. Xend
  112. X
  113. X# Done with all the uucps, get around the Xenix enable/disable bug.
  114. X
  115. Xsleep 60
  116. Xenable tty01
  117. X
  118. X# clean up and let us outa here.
  119. X
  120. Xrm /usr/spool/uucp/LCK..poll
  121. END_OF_poll
  122. if test 1414 -ne `wc -c <poll`; then
  123.     echo shar: \"poll\" unpacked with wrong size!
  124. fi
  125. # end of overwriting check
  126. fi
  127. echo shar: End of shell archive.
  128. exit 0
  129. -- 
  130. Bob Bownes, Aka Keptin Comrade Dr Bobwrench III    |  If I didn't say it, It
  131. bownesrm@beowulf.uucp  (518)-482-8798        |  must be true.
  132. {steinmetz,brspyr1,sun!sunbow}!beowulf!bownesrm    |    - me, tonite -
  133. "If I'd known it was harmless, I'd have killed it myself" Phillip K. Dick.
  134.